<?php 
	require_once("Smarty.class.php");
	
	class SmartyImpl extends Smarty 
	{
		
		private $lang;
		
		function __construct($lang)
		{
			$this->lang = $lang;

			$this->Smarty();
			$this->template_dir = S_TEMPLATES_DIR;
			$this->compile_dir = S_TEMPLATES_C_DIR;
			$this->config_dir = S_CONFIGS_DIR;
			$this->cache_dir = S_CACHE_DIR;
			
			Global $USE_JSON;
			if($USE_JSON){
				$this->left_delimiter = "{{";
				$this->right_delimiter = "}}";
			}
		}
		
		public function fetch($template, $cache_id = null, $compile_id = null, $display = false)
		{
			$section = explode('.',$template);
			$this->config_load($this->lang.'.conf',$section[0]);
			return parent::fetch($template, $cache_id, $compile_id, $display);
		}
	}
?>